//
//  DtailBrandTableViewCell.m
//  CarFace
//
//  Created by dlios on 15-3-25.
//  Copyright (c) 2015年 蓝鸥科技. All rights reserved.
//

#import "DtailBrandTableViewCell.h"

@implementation DtailBrandTableViewCell


- (void)dealloc
{
    [_nameLabel release];
    [_priceLabel release];
    [_carImage release];
    [_info2 release];
    [super dealloc];
    
}


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.nameLabel = [[UILabel alloc]init];
        [self.contentView addSubview:self.nameLabel];
        [_nameLabel release];
        
        self.priceLabel = [[UILabel alloc]init];
        [self.contentView addSubview:self.priceLabel];
        [_priceLabel release];
        
        self.carImage = [[UIImageView alloc]init];
        [self.contentView addSubview:self.carImage];
        [_carImage release];
        
//        self.contentView.backgroundColor = [UIColor colorFromHexCode:@"#7bbfea"];
    }
    
    return self;
}

-(void)layoutSubviews
{
    [super layoutSubviews];
    
    //设置carImage的frame和背景颜色
    self.carImage.frame = CGRectMake(5, 5, self.contentView.frame.size.width/3-5, self.contentView.frame.size.height-10);

    
    
    //设置nameLabel的frame和背景颜色
    self.nameLabel.frame = CGRectMake(self.contentView.frame.size.width/3 +10, 5, self.contentView.frame.size.width/3*2-10, self.contentView.frame.size.height/2-5);
//    self.nameLabel.backgroundColor = [UIColor greenColor];
    
    //设置priceLabel的frame和背景颜色
    self.priceLabel.frame = CGRectMake(self.contentView.frame.size.width/3 +10, self.contentView.frame.size.height/2-5, self.contentView.frame.size.width/3*2-10, self.contentView.frame.size.height/2-5);
//    self.priceLabel.backgroundColor = [UIColor greenColor];
    
    //赋值
    self.nameLabel.text = [self.info2 valueForKey:@"name"];
    self.priceLabel.text = [self.info2 valueForKey:@"price"];
    
    NSString *str2 = self.info2[@"imgurl"];
    str2 = [str2 stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    NSURL *url2 = [NSURL URLWithString:str2];
    [self.carImage setImageWithURL:url2];
    
    
}





- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
